import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 黎鹤舞
 * Date: 2023-10-30
 * Time: 23:43
 */
public class Test {

    //计算 1到 100 的所有整数中出现多少个数字9
    public static void main(String[] args) {
        //用来计数
        int count = 0;
        //用来遍历1~100
        for (int i = 0; i < 100; i++) {
            int firstNum = i % 10;
            int secondNum = i / 10;
            if(firstNum == 9) {
                count++;
            }
            if(secondNum == 9)
                count++;
        }

        System.out.println("1到 100 的所有整数中出现" + count + "个数字9");
    }


    //打印1~100内所有的素数
    public static void main2(String[] args) {
        //i用来遍历1~100个数，由于2为素数，所以从3开始
        System.out.println(2);
        int i = 3;
        //遍历除了1和自身外可以被整除的数
        int j = 2;
        for (i = 3; i <100 ; i++) {
            for(j = 2; j <i ; j++) {
                if(i % j == 0) {
                    break;
                }
            }
            if(j == i) {
                System.out.println(i);
            }
        }
    }

    //判断是否为素数
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int i = 2;
        if(num == 1)
            System.out.println(num + " is not prime");
        while(i < num)
        {
            if(num % i == 0) {
                break;
            }else {
                i++;
            }
        }
        if(i == num) {
            System.out.println(num + " is not prime");
        }else {
            System.out.println(num + " is prime");
        }

    }
}
